<script setup>
import DictTag from '@/components/DictTag/index.vue'
import { parseTime } from '@/utils/ruoyi.js'

defineOptions({
    name: 'defectList'
})

const { proxy } = getCurrentInstance()
const { repair_status } = proxy.useDict('repair_status')

/*缺陷设备*/
const defect = ref({
    open: false,
    list: null,
    title: ''
})

function open(data, title) {
    defect.value.list = data
    defect.value.title = title
    defect.value.open = true
}

defineExpose({
    open
})

</script>
<template>
  <!-- 查看缺陷设备 -->
    <el-dialog :title="defect.title" v-model="defect.open" width="700px" append-to-body>
        <el-table :data="defect.list">
            <el-table-column label="设备编号" align="center" prop="deviceId"/>
            <el-table-column label="问题描述" align="center" prop="description"/>
            <el-table-column label="上报人" align="center" prop="reportedBy"/>
            <el-table-column label="缺陷上报时间" align="center" prop="reportedAt" width="180">
                <template #default="{row}">
                    <span>{{ parseTime(row.reportedAt, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
                </template>
            </el-table-column>
            <el-table-column label="处理班组" align="center" prop="assignedTeam"/>
            <el-table-column label="缺陷状态" align="center" prop="status">
                <template #default="{row}">
                    <dict-tag :options="repair_status" :value="row.status"/>
                </template>
            </el-table-column>
        </el-table>
    </el-dialog>
</template>
<style scoped>

</style>
